import service from './request'
import md5 from 'js-md5'
import { useFlockInfoStore } from '@/stores/flockInfo'
import { useBaseParamStore } from '@/stores/baseParams'

const cqBaseUrl = import.meta.env.VITE_CQ_SERVER_URL
const accountId = import.meta.env.VITE_CQ_ACCOUNT_ID
const salt = import.meta.env.VITE_CQ_LOGIN_SALT
const headers = { 'Content-Type': 'application/json' }

// 查询养户生物资产
export const getFarmerBiologicalAssetsInfo = (params) => {
  return service.post(
    cqBaseUrl +
      '/kapi/v2/wens/wens_pig_asset_manager/FirmBiologicalAssetsController/getFarmerBiologicalAssetInfo',
    {
      ...params
    },
    {
      headers: headers
    }
  )
}

// 查询养户生物数据
export const getBiologicalAssetsInfo = (params) => {
  return service.post(
    cqBaseUrl +
      '/kapi/v2/wens/wens_pig_asset_manager/FirmBiologicalAssetsController/getBiologicalAssetsInfo',
    {
      ...params
    },
    {
      headers: headers
    }
  )
}

// 存栏盘点异常事件
export const getInventoryCheckAbnormalInfo = (params) => {
  return service.post(
    cqBaseUrl +
      '/kapi/v2/wens/wens_pig_asset_manager/FirmBiologicalAssetsController/getInventoryCheckAbnormalInfo',
    {
      ...params
    },
    {
      headers: headers
    }
  )
}

// 待确认死淘猪信息
export const getConfirmDeadInfo = (params) => {
  return service.post(
    cqBaseUrl +
      '/kapi/v2/wens/wens_pig_asset_manager/FirmBiologicalAssetsController/getConfirmDeadInfo',
    {
      ...params
    },
    {
      headers: headers
    }
  )
}

// 出栏点数异常事件
export const getAbnormalListingInfo = (params) => {
  return service.post(
    cqBaseUrl +
      '/kapi/v2/wens/wens_pig_asset_manager/FirmBiologicalAssetsController/getAbnormalListingInfo',
    {
      ...params
    },
    {
      headers: headers
    }
  )
}

// 进苗异常事件
export const getCollarSeedlingAbnormalInfo = (params) => {
  return service.post(
    cqBaseUrl +
      '/kapi/v2/wens/wens_pig_asset_manager/FirmBiologicalAssetsController/getCollarSeedlingAbnormalInfo',
    {
      ...params
    },
    {
      headers: headers
    }
  )
}

// 未处理尾猪事件
export const getUntreatedTailPigInfo = (params) => {
  return service.post(
    cqBaseUrl +
      '/kapi/v2/wens/wens_pig_asset_manager/FirmBiologicalAssetsController/getUntreatedTailPigInfo',
    {
      ...params
    },
    {
      headers: headers
    }
  )
}

// 户均尾猪处理天数
export const getPerHouseholdInfo = (params) => {
  return service.post(
    cqBaseUrl +
      '/kapi/v2/wens/wens_pig_asset_manager/FirmBiologicalAssetsController/getPerHouseholdInfo',
    {
      ...params
    },
    {
      headers: headers
    }
  )
}
